<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>25.数组去重</title>
</head>
<body>

  <script>
    // 传统方法
    function unique(arr) {
      const res= []

      arr.forEach(item => {
        console.log(res.indexOf(item));
        if (res.indexOf(item) < 0) {
          res.push(item)
        }
      })

      return res
    }
    console.log(unique([1,2,3,4,6,6]));


    let set = new Set([1,2,3,4,6,6])
    console.log([...set]);
  </script>
  
</body>
</html>
